#include "../include/BaseLib.hpp"

int set_noblocking(int sockfd)
{
	int flags, ret;
	flags = fcntl(sockfd, F_GETFL, 0);
	if (flags == -1) {
		perror("fcntl");
		return -1;
	}
	flags |= O_NONBLOCK;
	ret = fcntl(sockfd, F_SETFL, flags);
	if (ret == -1) {
		perror("fcntl");
		return -1;
	}
	return flags;
}